{% extends 'admin/master.html' %}
{% from "bootstrap/pagination.html" import render_pagination %}

{% block body %}
<div class="page-header">
  <div align="center">
    <h1>管理员主页</h1>
  </div>
</div>

<div class="container">
  <table class="table table-striped table-bordered" >
    <thead>
      <th width="10%" class='text-center'>姓名</th>
      <th width="4%" class='text-center'>性别</th>
      <th width="4%" class='text-center'>年龄</th>
      <th width="6%" class='text-center'>学历</th>
      <th width="4%" class='text-center'>照片</th>
      <th width="16%" class='text-center'>爱好</th>
      <th width="8%" class='text-center'>审核</th>
      <th width="8%" class='text-center'>操作</th>  
    </thead>
    {% if users %}
      {% for user in users %}
      <tr>
        <td>{{ user.name }}</td>
        <td>
          {% if user.gender == True %} 男 
          {% else %} 女 {% endif %}
        </td>
        <td>{{ now.year-user.birthday.year }}</td>
        <td>
          {% if user.education == '1' %}高职
          {% elif user.education == '2' %}本科
          {% elif user.education == '3' %}硕士
          {% elif user.education == '4' %}博士
          {% endif %}
        </td>
        <td style="text-align:center">
          <img src= '/static/image/{{ user.image }}' 
            width="15" 
            height="20" />
        </td>
        <td >
          {% for i in user.hobby %}
            {% if i == '1' %}篮球
            {% elif i == '2' %}足球
            {% elif i == '3' %}健身
            {% elif i == '4' %}其他
            {% endif %}
          {% endfor %}
        </td>
        <td >
          {% if user.verify == None %} 
            <span class="text-warning">未审核</span> 
          {% elif user.verify == True %} 
            <span class="text-success">通过</span> 
          {% else %} 
            <span class="text-danger">不通过</span> 
          {% endif %}
        </td>
        <td>
          <div class="btn-group">
            <form class="inline" method="POST"
                action="{{ url_for('AdminedView_delete', userid=user.id) }}">
              <a href="{{ url_for('AdminedView_verify_true', userid=user.id) }}">通过</a>
              <a href="{{ url_for('AdminedView_verify_false', userid=user.id) }}">不通过</a> 
              <button type="submit" class="btn btn-sm"
                onclick="return confirm('真的要删除吗？');">删除
              </button>
            </form>

         </div>
        </td>
      </tr>
      {% endfor%}
    {% endif %}
  </table>
  {% if users %}
      <div class="page-footer text-center">
        {{ render_pagination(pagination) }}
      </div>
  {% endif %}
</div>


{% endblock %}